﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Orgnization : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        InitMenu();
        int News_id = Convert.ToInt32(Session["News_id"]);
        OfficeDataClassesDataContext dc = new OfficeDataClassesDataContext();
        var News = from news in dc.News
                   where news.News_id.Equals(News_id)
                   select new
                   {
                       标题 = news.Title,
                       内容 = news.Content
                   };

        foreach (var news in News)
        {
            News_Title.Text = Convert.ToString(news.标题);
            News_Content.Text = Convert.ToString(news.内容);
        }
        dc.Dispose();
    }
    protected void InitMenu()
    {

        OfficeDataClassesDataContext dc = new OfficeDataClassesDataContext();
        MainMenu.Items.Clear();
        MenuItem MainPage = new MenuItem();
        MainPage.Enabled = true;
        MainPage.Selectable = true;
        MainPage.Selected = false;
        MainPage.Value = MainPage.ToolTip = MainPage.Text = "首页";
        MainPage.NavigateUrl = "Default.aspx";
        MainMenu.Items.Add(MainPage);
        var Menus = from menu in dc.Menus
                    select new
                    {
                        MenuItem_id = menu.MenuItem_id,
                        MenuItem_Name = menu.MenuItem_Name
                    };
        foreach (var menu in Menus)
        {
            MenuItem menuitem = new MenuItem();
            menuitem.Enabled = true;
            menuitem.Selectable = true;
            menuitem.Selected = false;
            menuitem.ToolTip = menuitem.Text = menu.MenuItem_Name.Trim();
            menuitem.Value = menu.MenuItem_id.ToString();
            if (menu.MenuItem_id == 2)
            {
                menuitem.NavigateUrl = "http://binhai.nankai.edu.cn/script/binhai/CollegeLeaderPage.htm";
            }
            else if (menu.MenuItem_id == 3)
            {
                menuitem.NavigateUrl = "OrgnizationList.aspx";
            }
            else if (menu.MenuItem_id == 4)
            {
                menuitem.NavigateUrl = "RuleList.aspx";
            }
            else if (menu.MenuItem_id == 5)
            {
                menuitem.NavigateUrl = "MeetingList.aspx";
            }
            else if (menu.MenuItem_id == 6)
            {
                menuitem.NavigateUrl = "CollegeConditionList.aspx";
            }
            else if (menu.MenuItem_id == 7)
            {
                menuitem.NavigateUrl = "LawList.aspx";
            }
            else if (menu.MenuItem_id == 8)
            {
                menuitem.NavigateUrl = "ResourceOnline.aspx";
            }
            MainMenu.Items.Add(menuitem);
        }
        dc.Dispose();
    }
}
